package com.elm.controller;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public interface BaseController {
    default void doHandle(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        try {
            handleRequest(req, resp);
        } catch (Exception e) {
            resp.sendError(500, "Internal Server Error");
        }
    }

    void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws Exception;
}